home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / ADA / GNAT / !gcc / adainc / 2 / ads / a-sytaco < prev    next >
Text File  |  1996-02-12  |  2KB  |  60 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT RUNTIME COMPONENTS                          --
  4. --                                                                          --
  5. --         A D A . S Y N C H R O N O U S _ T A S K _ C O N T R O L          --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.8 $                              --
  10. --                                                                          --
  11. -- This specification is adapted from the Ada Reference Manual for use with --
  12. -- GNAT.  In accordance with the copyright of that document, you can freely --
  13. -- copy and modify this specification,  provided that if you redistribute a --
  14. -- modified version,  any changes that you have made are clearly indicated. --
  15. --                                                                          --
  16. ------------------------------------------------------------------------------
  17.  
  18.  
  19. with System;
  20.  
  21. package Ada.Synchronous_Task_Control is
  22.  
  23.    type Suspension_Object is limited private;
  24.  
  25.    procedure Set_True (S : in out Suspension_Object);
  26.  
  27.    procedure Set_False (S : in out Suspension_Object);
  28.  
  29.    function Current_State (S : Suspension_Object) return Boolean;
  30.  
  31.    procedure Suspend_Until_True (S : in out Suspension_Object);
  32.  
  33. private
  34.  
  35.    --  ??? Suspension_Object is implemented as a record with a single
  36.    --      protected object field.  This is to program around a bug
  37.    --      in GNAT, which does not like limited private types
  38.    --      to be completed with a protected object.  Such a definition
  39.    --      will compile, but its use kills the compiler.
  40.  
  41.    --  ??? Using a protected object is overkill; suspension could be
  42.    --      implemented more efficiently.
  43.  
  44.    protected type Suspension_PO is
  45.       entry Wait;
  46.       procedure Set_False;
  47.       procedure Set_True;
  48.       function Get_Open return Boolean;
  49.       entry Wait_Exception;
  50.  
  51.    private
  52.       Open : Boolean := False;
  53.    end Suspension_PO;
  54.  
  55.    type Suspension_Object is record
  56.       Suspend : Suspension_PO;
  57.    end record;
  58.  
  59. end Ada.Synchronous_Task_Control;
  60.